package zhujie.zhujieservice;

import com.example.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import zhujie.zhujieridisrepostry.RedisPostry;

import java.util.List;

/**
 * Created by DELL on 2018/12/28.
 */
public class RedisServiceImpl implements RedisService {

    @Autowired
    private RedisPostry redisPostry;
    @Override
    @Cacheable
    public List<User> queryall() {

        return redisPostry.queryall();
    }

    @Override
    public User queryUserbyid(Integer id) {

        return redisPostry.querybyid(id);
    }

    @Override
    @CachePut
    public User queryUserbyid(User user) {

        return redisPostry.updateUser(user);
    }


}
